package com.smart.admin.controller;

import com.smart.admin.service.UploadService;
import com.smart.common.vo.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

/**
 *
 */
@RestController
@RequestMapping("/upload")
public class UploadController {
    @Resource
    UploadService uploadService;

    @PostMapping("img")
    public ResponseResult<String> upload(@RequestBody MultipartFile file) throws IOException {
        return ResponseResult.success(uploadService.uploadAliOss(file));
    }
}
